package com.bungarus.ratelimit;

import java.lang.annotation.*;
/**
 * Annotation to defining the rate limiter
 *
 * Created by tang on 2019/10/30.
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Limiter {
    /**
     * Returns the threshold of the rate limiter
     * @return the threshold of the rate limiter
     */
    int limit() default 300;

    /**
     * Returns the name of user unique id as HttpServletRequest's attribute
     * @return the name of user unique id as HttpServletRequest's attribute
     */
    String request() default "";

    /**
     * Returns the http header name of authentication token. It must accompany with using of HttpServletRequest method
     * parameter
     * @return the http header name of authentication token
     */
    String header() default "";

    /**
     * Returns the measuring unit
     * @return the measuring unit
     */
    LimitUnit unit() default LimitUnit.HOUR;
}
